﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/Template.cshtml";
}

<h2>Personnel application enquiry</h2>
<link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
<script src="~/Scripts/js/jquery.min.js"></script>
<script src="~/Scripts/js/bootstrap.min.js"></script>
<input id="Hidden1" type="hidden" value="@ViewBag.id" />
<div id="div"></div>
@*<a href="/ModiFication/schedule/' + obj[i].ApplyStatu + '" onclick="funcha(' + obj[i].ApplyStatu + ')">查看进度</a>*@
<script>
    $(function () {
        var EmployID = $("#Hidden1").val();
        $.ajax({
            url: "/ModiFication/Changelist",
            data: { EmployID: EmployID },
            success:function(obj)
            {
                obj = JSON.parse(obj);
                alert(obj)
                var s = "";
                s += '<table id="t1" class="table-bordered table table-condensed table-responsive">';
                s+='<thead>'
                s += '<tr><td>员工编号</td><td>员工姓名</td><td>变更状态</td><td>变更职位</td><td>变更部门</td><td>申请时间</td><td>申请理由</td><td>是否成功</td></tr></thead>';
                s += '<tbody>'
                for (var i = 0; i < obj.length; i++) {
                    if (obj[i].ChangeStatu == 1)
                    {
                        if (obj[i].ApplyStatu == -1)
                        {
                            s += '<tr><td>' + obj[i].EmployID + '</td><td>' + obj[i].EmployName + '</td><td>晋升申请</td><td>' + obj[i].PositionName + '</td><td>' + obj[i].DeptName + '</td><td>' + obj[i].Change_time + '</td><td>' + obj[i].Change_Reason + '</td><td>  <h2 style="color:red">您的申请以失败！</h2></td></tr>'
                        } else {
                            s += '<tr><td>' + obj[i].EmployID + '</td><td>' + obj[i].EmployName + '</td><td>晋升申请</td><td>' + obj[i].PositionName + '</td><td>' + obj[i].DeptName + '</td><td>' + obj[i].Change_time + '</td><td>' + obj[i].Change_Reason + '</td><td><a href="/ModiFication/schedule/' + obj[i].Situation_id + '">查看进度</a></td></tr>'
                        }

                       
                    }
                    else if(obj[i].ChangeStatu == 2)
                    {
                        if (obj[i].ApplyStatu == -1) {
                            s += '<tr><td>' + obj[i].EmployID + '</td><td>' + obj[i].EmployName + '</td><td>降级申请</td><td>' + obj[i].PositionName + '</td><td>' + obj[i].DeptName + '</td><td>' + obj[i].Change_time + '</td><td>' + obj[i].Change_Reason + '</td>  <h2 style="color:red">您的申请以失败！</h2></tr>'
                        } else {
                            s += '<tr><td>' + obj[i].EmployID + '</td><td>' + obj[i].EmployName + '</td><td>降级申请</td><td>' + obj[i].PositionName + '</td><td>' + obj[i].DeptName + '</td><td>' + obj[i].Change_time + '</td><td>' + obj[i].Change_Reason + '</td><td><a href="/ModiFication/schedule/' + obj[i].Situation_id + '">查看进度</a></td></tr>'
                        }
                       
                    }
                    
                   
                }
                s += '</tbody>'
                s += '</table>'
                $("#div").html(s);

            }
        })

    })
    //function funcha(ApplyStatu)
    //{
        
    //}
</script>